package com.student.dao;

import com.student.entity.User;

import org.hibernate.Session;
//import org.omg.CORBA.Object;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by dongge on 16/9/16.
 */
@Repository
public class UserDao extends BaseDao<User> {
    public User getUserByUsername(String username){
        String hql = "select u from User u where u.username=:username";
        Session session = getSession();
        Object object = session.createQuery(hql).setString("username",username).uniqueResult();
        return (User)object;
    }
}
